<template>
  <div class="header">
    <van-search
      shape="round"
      background="#4fc08d"
      v-model="value"
      show-action
      label="地址"
      placeholder="请输入搜索关键词"
      @search="onSearch"
    >
      <template #action>
        <div @click="onSearch(value)">搜索</div>
      </template>
    </van-search>
  </div>
</template>

<script>
import {mapMutations, mapActions} from "vuex"
export default {
  name: "Headerinp",

  data() {
    return {
      value:"",
      item:[]
    };  
  },

  mounted() {},

  methods: {
      ...mapMutations(['SET_SEARCH']),
      ...mapActions(['GET_LIST']),
      onSearch(value){
          if(value !==''){
            this.SET_SEARCH(value)
          }else{
              this.GET_LIST();
          }
          
      }
  },
};
</script>

<style lang="scss" scoped>
</style>